﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LSBLL;
using LSEntity;
using LSInterFace;
using LSUtility;

namespace OralExamBLL
{
    public class OEControllerCheck : ControllerCheckBase
    {

    }
    public class OEStudentControllerCheck : ControllerCheckBase
    {
        public override int ControllerCheck<T1, T2, T3>(T1 t1, T2 t2, T3 t3)
        {
            var testId = t1.Obj2Int(0);
            var password = t2.Obj2Str();
            var isCheckPass = t3.Obj2Bool();
            if (testId > 0)
            {
                var member = MemberBLL.MemberCurrent;
                var test = TestBLL.TestGetClassGetList(member.MyClass.ClassId)
                                  .FirstOrDefault(m => m.TestId == testId);
                if (test == null)
                {
                    return (int)TestingStatus.TestError;
                }
                if (isCheckPass)
                {
                    if (test.PassWord.Obj2Str() != password)
                    {
                        return (int)TestingStatus.TestPassError;
                    }
                }
                var result = test.TestingStatus;
                if (result == TestingStatus.TestIng)
                {
                    TestBLL.TestOTCurrent = new TestOTCurrent
                                              {
                                                  TestClassEntity = test,
                                              };
                }
                return (int)result;
            }
            return (int)TestingStatus.TestError;
        }
    }
    public class OETeacherControllerCheck : ControllerCheckBase
    {

    }
}
